import Vue from 'vue'
import Router from 'vue-router'
// import MyViewmain from '../view/common/main.vue'
import userList from '../view/user/userList.vue'
import indexVue from '../view/common/index.vue'
import addUserOrUpdate from '../view/user/addOrUpdate.vue'
import VueRouter from 'vue-router'
import show from '../view/permission/show.vue'
import addOrUpdatePermission from '../view/permission/addOrUpdatePermission.vue'


import roleList from '@/view/role/roleList.vue'
import addOrUpdate from '@/view/role/addOrUpdate.vue'


const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).location(err => err)
}



Vue.use(Router)

export default new Router({
  routes: [{
    path: '/',
    component: indexVue
  },
    {
      path: '/toUserList',
      component: userList
    },
    {
      path: '/toAddUserOrUpdate',
      component: addUserOrUpdate
    },
    {
      path: '/toAddUserOrUpdate/:id',
      component: addUserOrUpdate
    },
    {
      path: '/showPer',
      component: show
    }
    ,
    {
      path:'/addOrUpdatePermission',
      component: addOrUpdatePermission
    },
    //如果是修改和新增在同一个页面上的话要注意路由id
    {
      path:'/addOrUpdatePermission/:id',
      component: addOrUpdatePermission
    } ,
    {
      path:'/toRolePage',//分页角色
      component: roleList
    },
     {
      path:'/addOrUpdate',//添加  /updateRole
      component: addOrUpdate
    }, 
     {
      path: '/updateRole/:id',
      component: addOrUpdate
    },


  ]
})
